﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using WindowsFormsApplication3;

namespace bsy
{
    public partial class sy_new_cartNum : Form
    {

        private string cartNum;

        public string CartNum
        {
            get { return cartNum; }
            set { cartNum = value; }
        }

        public sy_new_cartNum()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if ("".Equals(newcart_Num.Text.ToString().Trim()))
            {
                error_msg.Text = "卡号不能为空";
                return;
            }
            else
            {
                error_msg.Text = "";
            }
            cartNum = newcart_Num.Text.ToString().Trim();
            string query = string.Format("select count(*) from Re_customer_card where card_number={0}", cartNum);
            int count = int.Parse(CommonDB.GetSingle(query).ToString());
            if (count >0)
            {
               MessageBox.Show("此卡账号已被使用", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                cartNum = "";
                return;
            }
            this.DialogResult = DialogResult.OK;
        }
    }
}
